package org.xsk.mall.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import org.xsk.mall.api.demo.HelloWorldReq;
import org.xsk.mall.api.demo.HelloWorldResp;
import org.xsk.mall.api.demo.demo.FirstService;

/**
 * description: 第一个接口
 * <p>
 * date: 2021/8/18 15:32
 * author: x-one
 */
@Api(value = "FirstController",tags = "first controller")
@RestController
public class FirstController implements FirstService {

    @RequestMapping(value = "noPro" , method = RequestMethod.POST)
    public String noPro(){
        return "Hello World!";
    }

    @RequestMapping(value = "pro" , method = RequestMethod.POST , produces = {"application/x-protobuf","application/json"})
    public HelloWorldResp pro(){return HelloWorldResp.newBuilder().setParam("Hello World!").build();}

    @Override
    public HelloWorldResp helloWorld(HelloWorldReq helloWorldReq) {
        return HelloWorldResp.newBuilder().setParam("Hello World!").build();
    }
}
